package demo8.test1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 姚东名
 * Date: 2024-06-13
 * Time: 14:32
 */
public class Student {
    //实例代码块
    private String name;
    private String gender;
    private int age;
    private double score;
    private static String classRoom;//班级

    public Student() {
        System.out.println("I am a student init()");
    }

    //实例代码块
    {
        this.name = "zhangsan";
        this.gender = "男";
        this.age = 19;
        System.out.println("I am a instance init()");
    }

    //静态代码块
    static {
        classRoom = "113";
        System.out.println("I am static init()");
    }

    public void show() {
        System.out.println("name：" + this.name + " age：" + this.age + " gender：" + this.gender);
    }
}
/*
public static void main(String[] args) {
    Student student1 = new Student();
    Student student2 = new Student();
}
 */

/*
public static void main(String[] args) {
    Student student = new Student();
    student.show();
}

//运行结果
I am a instance init()
I am a student init()
name：zhangsan age：19 gender：男
 */
